<table id="source_title" class="item_list" cellspacing="0" cellpadding="0" border="0">
<thead class="fields">
    <tr>
        <th class="first"><?php echo ucfirst($txt->getWord('source')); ?></th>
        <th class="center"><?php echo ucfirst($txt->getWord('delimiter')); ?></th>
        <th class="center"><?php echo ucfirst($txt->getWord('columns')); ?></th>
        <th class="center"><?php echo ucfirst($txt->getWord('rows')); ?></th>
        <th class="center"><?php echo ucfirst($txt->getWord('definitions_on_row')); ?></th>
        <th class="center"><?php echo ucfirst($txt->getWord('start_on_row')); ?></th>
        <th class="last"><?php echo ucfirst($txt->getWord('import')).' '.ucfirst($txt->getWord('target')).' '.ucfirst($txt->getWord('root')).'-'.ucfirst($txt->getWord('section')); ?></th>
    </tr>
</thead>    
<tbody>
	<tr>
    	<td class="first">&nbsp;&nbsp;
        	<?php if($exe['src_loc_type'] == 1): ?>
			<?php echo $exe['src_loc']; ?>
            <?php else : ?>
            <?php echo $exe['src_loc']; ?>
            <?php endif; ?>&nbsp;&nbsp;
        </td>
        <td class="center">
        	<select class="xsmall" name="delimiter" onchange="submit();">
            	<option value=";" <?php echo getIsSelectedHTML($exe['delimiter'], ';'); ?>>;</option>
                <option value="," <?php echo getIsSelectedHTML($exe['delimiter'], ','); ?>>,</option>
                <option value=":" <?php echo getIsSelectedHTML($exe['delimiter'], ':'); ?>>:</option>
            </select>
		</td>
        <td class="center"><?php echo $columns; ?></td>
        <td class="center"><?php echo $lines; ?></td>
        <td class="center">
        	<select class="small" name="def_row" onchange="submit();">
            <option value="0" <?php echo getIsSelectedHTML($exe['def_row'], '0'); ?>><?php echo ucfirst($txt->getWord('none')); ?></option>
            <?php 
			if($lines > 100)
			{ $mlines = 100; }
			else
			{ $mlines = $lines; }
			for($i=1; $i<=$mlines; $i++)
			{ echo '<option value="'.$i.'" '.getIsSelectedHTML($exe['def_row'], $i).'>'.$i.'</option>'; }
			?>	
            </select>
		</td>
        <td class="center">
        	<select class="small" name="start_row" onchange="submit();">
            <?php 
			if($lines > 100)
			{ $mlines = 100; }
			else
			{ $mlines = $lines; }
			for($i=1; $i<=$mlines; $i++)
			{ echo '<option value="'.$i.'" '.getIsSelectedHTML($exe['start_row'], $i).'>'.$i.'</option>'; }
			?>	
            </select>
		</td>
        <td class="last">
            <select class="small-m" name="target_root_id" onchange="submit();">
                <option value="0" <?php echo getIsSelectedHTML($exe['target_root_id'], '0'); ?>><?php echo ucfirst($txt->getWord('none')); ?></option>
                <?php 
				if($sections)
				{
					foreach($sections as $section)
					{
						echo '<option value="'.$section['id'].'" '.getIsSelectedHTML($exe['target_root_id'], $section['id']).'>'.$section['title'].'</option>';
					}
				}
                ?>	
            </select>
        </td>
        <td rowspan="2">
        	<?php if($eFields): ?>
            <a href="?con=<?php echo $_GET['con']; ?>&exe=<?php echo $_REQUEST['exe']; ?>&run=<?php echo $_REQUEST['exe']; ?>">
                <img class="icon command" src="<?php echo SYSICONS_URL; ?>forward_22.gif" onclick="edit_form.submit();"  />
            </a>
            <?php endif; ?>
        </td>
    </tr>
</tbody>
</table>
<table id="source_format" class="item_list" cellspacing="0" cellpadding="0" border="0">
	<thead class="fields">
        <tr>
        	<th class="first"><?php echo ucfirst($txt->getWord('field')); ?> # </th>
        	<th><?php echo ucfirst($txt->getWord('source')); ?></th>
            <th><?php echo ucfirst($txt->getWord('target')).' '.ucfirst($txt->getWord('data')).' '.ucfirst($txt->getWord('type')); ?></th>
            <th><?php echo ucfirst($txt->getWord('data')).' '.ucfirst($txt->getWord('type')).' '.ucfirst($txt->getWord('field')); ?></th>
            <th>
				<?php 
				echo ucfirst($txt->getWord('if')).' ';
				echo ucfirst($txt->getWord('empty')).' '; 
				echo ucfirst($txt->getWord('field')).' '; 
				?>
           </th>
           <th><?php echo ucfirst($txt->getWord('standard')).' '.ucfirst($txt->getWord('value')); ?></th>
           <th><?php echo ucfirst($txt->getWord('perfix')); ?></th>
           <th class="last"><?php echo ucfirst($txt->getWord('postfix')); ?></th>
        </tr>
    </thead>       
    <tbody>
	   <?php 
       if($data) 
       {	
            $i = 1;
			$j = 0;
            foreach($data as $col)
            {
                ?>
                <tr>
                	<td class="first">
                    	&nbsp;&nbsp;<?php echo $j; ?>&nbsp;&nbsp;
                        <input type="hidden" name="from_field_no[]" value="<?php echo $j; ?>" />
                        <?php echo $eFields[$j]['from_field_no']; ?>
                    </td>
                    <td>
                    	&nbsp;&nbsp;<?php echo $col; ?>&nbsp;&nbsp;
                        <input type="hidden" name="from_field_title[]" value="<?php echo $col; ?>" />
                    </td>
                    <td>
                        <select class="small-m" name="to_table[]" <?php echo getIsEnabledHTML($eFields[$j]['from_field_no'] == $j); ?> >
                            <option value="0" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], ''); ?>><?php echo ucfirst($txt->getWord('ignore')); ?></option>
                            <option value="menu" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], 'menu'); ?>><?php echo ucfirst($txt->getWord('section')); ?></option>
                            <option value="product" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], 'product'); ?>>
								<?php echo ucfirst($txt->getWord('product')); ?>
                            </option>
                            <option value="product_vars" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], 'product_vars'); ?>>
								<?php echo ucfirst($txt->getWord('variation')); ?>
                            </option>
                            <option value="product_vals" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], 'product_vals'); ?>>
                            	<?php echo ucfirst($txt->getWord('product')).' '.ucfirst($txt->getWord('attribute')); ?>
                            </option>
                            <option value="product_var_vals" <?php echo getIsSelectedHTML($eFields[$j]['to_table'], 'product_var_vals'); ?>>
                            	<?php echo ucfirst($txt->getWord('variation')).' '.ucfirst($txt->getWord('attribute')); ?>
                            </option>
                        </select>
                    </td>
                    <td>
                    	<?php if($eFields[$j]['to_table'] == ''): ?>
                        <input type="hidden" name="to_field[]" value="">
                        <?php else: ?>
                    	<?php $fields = getexefields($eFields[$j]['to_table']); ?>
                        <select class="medium" name="to_field[]" <?php echo getIsEnabledHTML($eFields[$j]['to_table'] != ''); ?> >
                        	<?php if($fields): ?>
                            <option value="0"><?php echo ucfirst($txt->getWord('select')); ?></option>
                            <?php foreach($fields as $field): ?>
							<option value="<?php echo $field['value']; ?>" <?php echo getIsSelectedHTML($eFields[$j]['to_field'], $field['value']); ?>>
								<?php echo $field['title']; ?>
                            </option>
                            <?php endforeach; ?>
                            <?php endif; ?>
                        </select>
                        <?php endif; ?>
                    </td>
                    <td>
                    	<?php if($eFields[$j]['to_field'] == ''): ?>
                        <input type="hidden" name="if_empty_action[]" value="0">
                        <?php else: ?>
                        <select class="small-m" name="if_empty_action[]" <?php echo getIsEnabledHTML($eFields[$j]['to_field'] != ''); ?> onchange="submit();">
                        	<option value="0" <?php echo getIsSelectedHTML($eFields[$j]['if_empty_action'], 0); ?>>
								<?php echo ucfirst($txt->getWord('do')); ?> <?php echo ucfirst($txt->getWord('nothing')); ?>
                            </option>
                            <option value="1" <?php echo getIsSelectedHTML($eFields[$j]['if_empty_action'], 1); ?>>
								<?php echo ucfirst($txt->getWord('jumpover')); ?>
                            </option>
                            <option value="2" <?php echo getIsSelectedHTML($eFields[$j]['if_empty_action'], 2); ?>>
								<?php echo ucfirst($txt->getWord('use')); ?>
                                <?php echo ucfirst($txt->getWord('default')); ?>
                                <?php echo ucfirst($txt->getWord('value')); ?>
                            </option>
                        </select>
                        <?php endif; ?>
                    </td>
                    <td>
                    	<?php 
						if($eFields[$j]['if_empty_action'] == 2)
						{ echo getExeDefaultValueOptions($eFields[$j]['to_table'], $eFields[$j]['to_field'], $eFields[$j]['default_value']); } 
						else
						{ echo '<input type="hidden" class="medium" name="default_value[]" value="'.$eFields[$j]['default_value'].'">'; }
						?>
                    </td>
                    <td><input type="text" class="xsmall" name="perfix[]" maxlength="50" value="<?php echo $eFields[$j]['perfix']; ?>"></td>
                    <td class="last"><input type="text" class="xsmall" name="postfix[]" maxlength="50" value="<?php echo $eFields[$j]['postfix']; ?>"></td>
                </tr>
                <?php
				$i++;
				$j++;
            }
       }
       ?>
    </tbody>
</table>